<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
   
<%@ page import="fr.iut2.tc4.aideprojet2.torque.generated.Groupe"%>
<%@ page import="fr.iut2.tc4.aideprojet2.torque.generated.GroupePeer"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link href="style/style.css" rel="stylesheet" type="text/css">
</head>
<body>


<div class='corps'>
<%@ include file="menu.jsp"%>

	<%!
	private int i = 0;

	private int id;
	private String nom;
	private String style;
	%>

	<h1>Gestion des groupes</h1>
	<table class="corps" id="liste">
	<tr>
	<th>Id</th>
	<th>Nom</th>
	<th colspan="3">Actions</th>
	</tr>
	
<%
	for (Groupe grp: GroupePeer.doSelectAll()) {
		i = i+1;
		id = grp.getGroupeId();
		nom = grp.getNom();
		
		if (i%2 == 0) {
			style = "pair";				
		}
		else{ 
			style = "impair";
		}
	
%>
	
	
	<tr class="<%=style%>">
	<td><%=id%></td>
	<td><%=nom%></td>
	<td align="center"><a href='voirGroupes.jsp?id=<%=id%>'><img src="img/loupe-icon.png" alt="Voir" title="Voir" style="width:20px; height:20px; border:none;" /></a></td>
	<td align="center"><a href='editerGroupe.jsp?id=<%=id%>'><img src="img/edit-icon.png" alt="Edit" title="Editer" style="width:20px; height:20px; border:none;" /></a></td>
	<td align="center"><a href='#'><img src="img/delete-icon.png" alt="Delete" title="Supprimer" style="width:20px; height:20px; border:none;" /></a></td>
	</tr>
	
	
	<% } %>
	</table>
	<br/>
	<br/>
	 <HR width=75% size=4>
	<div class="form">
	<h2>Ajouter un groupe</h2>
	<form action="ajouterGroupeAction.jsp" method="post">
		<input type="text" name="nom" placeholder="Nom">
		<input type="submit" name="submit" value="Ajouter"/>
	</form>
	</div>
</div>
</body>
</html>